﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using StackExchangeRedis;

namespace RedisSubscribe
{
    class Program
    {
        static void Main(string[] args)
        {
            var redisHelper = new RedisHelper();
            Console.WriteLine("请输入发布者通道");
            var isreicve = false;
            var chanel = Console.ReadLine();
            redisHelper.Subscribe(chanel, (channel, message) =>
            {
                isreicve = true;
                Console.WriteLine($"我收到来自{chanel}发布的消息为：" + message);
            });
            if (!isreicve)
            {
                Console.WriteLine("暂未收到任何消息");
            }
            Console.ReadLine();
        }
    }
}
